<?php

/**
 * Log日志处理类
 * Created by PhpStorm.
 * User: simon_min@aliyun.com
 * Date: 2016/11/5
 * Time: 16:07
 */
class Log
{
    static public function write($msg, $level = 'ERROR', $type = 3, $dest = NULL)
    {
        if (!C('SAVE_LOG')) return;
        if (is_null($dest)) {
            $dest = LOG_PATH . '/' . date('Y-m-d') . '.log';
        }

        if (is_dir(LOG_PATH)) {
            error_log("[TIME]:" . date('Y-m-d H:i:s') . " {$level}:{$msg}\r\n", $type, $dest);
        }
    }
}